﻿(function(ua) {
var b = {
    msie: /msie/.test(ua) && !/opera/.test(ua),
    opera: /opera/.test(ua),
    safari: /webkit/.test(ua) && !/chrome/.test(ua),
    firefox: /firefox/.test(ua),
    chrome: /chrome/.test(ua)
};
for (var i in b) {
    if (b[i]) {
        b.version=parseFloat((/version\/([\d.]+)/i.test(ua) || RegExp(i + '[\\/| ]([\\d.]+)', 'i').test(ua)) ? RegExp.$1 : '0');
        break;
     }
}
if (b.msie && b.version >= 5.5 && b.version < 7) {
    window.onload=function() {
        var imgs = document.images;
        for (var j = 0; j < imgs.length; j++) {
            if (/\.png$/.test(imgs[j].src)) {
                var img = new Image();
                img.src = imgs[j].src;
                var imgID = (imgs[j].id) ? "id='" + imgs[j].id + "' " : "";
                var imgClass = (imgs[j].className) ? "class='" + imgs[j].className + "' " : "";
                var imgTitle = (imgs[j].title) ? "title='" + imgs[j].title + "' " : "title='" + imgs[j].alt + "' ";
                var imgStyle = "display:inline-block;" + imgs[j].style.cssText;
                if (imgs[j].align == "left") imgStyle = "float:left;" + imgStyle;
                if (imgs[j].align == "right") imgStyle = "float:right;" + imgStyle;
                if (imgs[j].parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
                 + " style=\"width:" + img.width + "px;height:" + img.height + "px;" + imgStyle + ";"
                 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                 + "(src=\'" + imgs[j].src + "\', sizingMethod='scale');\"></span>";
                imgs[j].outerHTML = strNewHTML;
                j = j - 1;
            }
        }
        try { document.execCommand("BackgroundImageCache", false, true); } catch (e) { }
    };
}
})(navigator.userAgent.toLowerCase())